﻿using System;
namespace Producers.Liiklusregister.Xtee.Riik.Ee.Producer.Liiklusregister {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="paring3_soidukiandmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring3Soidukiandmed))]
    public class Paring3SoidukiandmedSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected IParing3Soidukiandmed clazz;
        
        public Paring3SoidukiandmedSerializer(IParing3Soidukiandmed clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            Writer.WriteStartElement("regmrk");
            if (clazz.Regmrk!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regmrk))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("nr_tyyp");
            if (clazz.NrTyyp!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.NrTyyp))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun");
            if (clazz.Regtun!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regtun))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun_kuup");
            if (clazz.RegtunKuup!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegtunKuup))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kehtiv");
            if (clazz.Kehtiv!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kehtiv))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtulek");
            if (clazz.Regtulek!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Regtulek))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("regtun_valjastaja");
            if (clazz.RegtunValjastaja!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.RegtunValjastaja))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("idkood");
            if (clazz.Idkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Idkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("vinkood");
            if (clazz.Vinkood!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Vinkood))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("soiduki_andmed");
            if (clazz.SoidukiAndmed!=null) {
                global::Xtee.Core.SerializationMetadata metaSoidukiAndmed = this.GetMetaData(clazz.SoidukiAndmed);
                Writer.WriteTypeAttribute(metaSoidukiAndmed.TypeQualifiedName.Namespace, metaSoidukiAndmed.TypeQualifiedName.Name);
                metaSoidukiAndmed.NewSerializer(clazz.SoidukiAndmed).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : SoidukiAndmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("piirang");
            if (clazz.Piirang!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Piirang))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("oma_andmed_v");
            if (clazz.OmaAndmedV!=null) {
                global::Xtee.Core.SerializationMetadata metaOmaAndmedV = this.GetMetaData(clazz.OmaAndmedV);
                Writer.WriteTypeAttribute(metaOmaAndmedV.TypeQualifiedName.Namespace, metaOmaAndmedV.TypeQualifiedName.Name);
                metaOmaAndmedV.NewSerializer(clazz.OmaAndmedV).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaAndmedV");
            }
            Writer.WriteEndElement();
            if (((clazz.KaasomaAndmedV == null) 
                        || (clazz.KaasomaAndmedV.Count < 1m))) {
                throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "kaasoma_andmed_v");
            }
            for (int x = 0; ((clazz.KaasomaAndmedV != null) 
                        && (x < clazz.KaasomaAndmedV.Count)); x = (x + 1)) {
                Writer.WriteStartElement("kaasoma_andmed_v");
                if (clazz.KaasomaAndmedV[x]!=null) {
                    global::Xtee.Core.SerializationMetadata metaKaasomaAndmedV = this.GetMetaData(clazz.KaasomaAndmedV[x]);
                    Writer.WriteTypeAttribute(metaKaasomaAndmedV.TypeQualifiedName.Namespace, metaKaasomaAndmedV.TypeQualifiedName.Name);
                    metaKaasomaAndmedV.NewSerializer(clazz.KaasomaAndmedV[x]).WriteXml(Writer);
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KaasomaAndmedV");
                }
                Writer.WriteEndElement();
            }
            Writer.WriteStartElement("vkasut_andmed");
            if (clazz.VkasutAndmed!=null) {
                global::Xtee.Core.SerializationMetadata metaVkasutAndmed = this.GetMetaData(clazz.VkasutAndmed);
                Writer.WriteTypeAttribute(metaVkasutAndmed.TypeQualifiedName.Namespace, metaVkasutAndmed.TypeQualifiedName.Name);
                metaVkasutAndmed.NewSerializer(clazz.VkasutAndmed).WriteXml(Writer);
            }
            else {
                throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VkasutAndmed");
            }
            Writer.WriteEndElement();
            Writer.WriteStartElement("kasutajad");
            if (clazz.Kasutajad!=null) {
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kasutajad))).ToString());
            }
            else {
                Writer.WriteAttributeString("xsi", "nil", null, "1");
            }
            Writer.WriteEndElement();
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
            if (Reader.LocalName=="regmrk") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Regmrk = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regmrk")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>regmrk", Reader.LocalName);
            }
            if (Reader.LocalName=="nr_tyyp") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.NrTyyp = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("nr_tyyp")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>nr_tyyp", Reader.LocalName);
            }
            if (Reader.LocalName=="regtun") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Regtun = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>regtun", Reader.LocalName);
            }
            if (Reader.LocalName=="regtun_kuup") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RegtunKuup = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun_kuup")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>regtun_kuup", Reader.LocalName);
            }
            if (Reader.LocalName=="kehtiv") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kehtiv = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kehtiv")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>kehtiv", Reader.LocalName);
            }
            if (Reader.LocalName=="regtulek") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Regtulek = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtulek")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>regtulek", Reader.LocalName);
            }
            if (Reader.LocalName=="regtun_valjastaja") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.RegtunValjastaja = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("regtun_valjastaja")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>regtun_valjastaja", Reader.LocalName);
            }
            if (Reader.LocalName=="idkood") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Idkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("idkood")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>idkood", Reader.LocalName);
            }
            if (Reader.LocalName=="vinkood") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Vinkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vinkood")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>vinkood", Reader.LocalName);
            }
            if (Reader.LocalName=="soiduki_andmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring3_soidukiandmed>soiduki_andmed");
                }
                global::Xtee.Core.SerializationMetadata metaSoidukiAndmed = this.GetMetaData<Paring3Soidukiandmed.ISoidukiAndmedType>(Reader, ">>paring3_soidukiandmed>soiduki_andmed", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
                clazz.SoidukiAndmed = metaSoidukiAndmed.NewEntity<Paring3Soidukiandmed.ISoidukiAndmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("soiduki_andmed");
                    metaSoidukiAndmed.NewSerializer(clazz.SoidukiAndmed).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>soiduki_andmed", Reader.LocalName);
            }
            if (Reader.LocalName=="piirang") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Piirang = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("piirang")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>piirang", Reader.LocalName);
            }
            if (Reader.LocalName=="oma_andmed_v") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring3_soidukiandmed>oma_andmed_v");
                }
                global::Xtee.Core.SerializationMetadata metaOmaAndmedV = this.GetMetaData<Paring3Soidukiandmed.IOmaAndmedVType>(Reader, ">>paring3_soidukiandmed>oma_andmed_v", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
                clazz.OmaAndmedV = metaOmaAndmedV.NewEntity<Paring3Soidukiandmed.IOmaAndmedVType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("oma_andmed_v");
                    metaOmaAndmedV.NewSerializer(clazz.OmaAndmedV).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>oma_andmed_v", Reader.LocalName);
            }
            clazz.KaasomaAndmedV = new System.Collections.Generic.List<Paring3Soidukiandmed.IKaasomaAndmedVType>();
            for (; ((Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
                        && (Reader.LocalName == "kaasoma_andmed_v")); ) {
                if (Reader.LocalName=="kaasoma_andmed_v") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring3_soidukiandmed>kaasoma_andmed_v");
                    }
                    global::Xtee.Core.SerializationMetadata metaKaasomaAndmedV = this.GetMetaData<Paring3Soidukiandmed.IKaasomaAndmedVType>(Reader, ">>paring3_soidukiandmed>kaasoma_andmed_v", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
                    Paring3Soidukiandmed.IKaasomaAndmedVType item = metaKaasomaAndmedV.NewEntity<Paring3Soidukiandmed.IKaasomaAndmedVType>();
                    clazz.KaasomaAndmedV.Add(item);
                    if ((Reader.IsEmptyElement == false)) {
                        Reader.ReadStartElement("kaasoma_andmed_v");
                        metaKaasomaAndmedV.NewSerializer(item).ReadXml(Reader);
                        Reader.ReadEndElement();
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>kaasoma_andmed_v", Reader.LocalName);
                }
            }
            if ((clazz.KaasomaAndmedV.Count < 1m)) {
                throw new global::Xtee.Core.Exceptions.MinOccurrenceException(1m, "kaasoma_andmed_v");
            }
            if (Reader.LocalName=="vkasut_andmed") {
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>paring3_soidukiandmed>vkasut_andmed");
                }
                global::Xtee.Core.SerializationMetadata metaVkasutAndmed = this.GetMetaData<Paring3Soidukiandmed.IVkasutAndmedType>(Reader, ">>paring3_soidukiandmed>vkasut_andmed", "http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister");
                clazz.VkasutAndmed = metaVkasutAndmed.NewEntity<Paring3Soidukiandmed.IVkasutAndmedType>();
                if ((Reader.IsEmptyElement == false)) {
                    Reader.ReadStartElement("vkasut_andmed");
                    metaVkasutAndmed.NewSerializer(clazz.VkasutAndmed).ReadXml(Reader);
                    Reader.ReadEndElement();
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>vkasut_andmed", Reader.LocalName);
            }
            if (Reader.LocalName=="kasutajad") {
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kasutajad = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kasutajad")).Value;
                }
                else {
                    Reader.Skip();
                }
            }
            else {
                throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>paring3_soidukiandmed>kasutajad", Reader.LocalName);
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring3_soidukiandmed>soiduki_andmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring3Soidukiandmed.SoidukiAndmedType))]
        public class SoidukiAndmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring3Soidukiandmed.ISoidukiAndmedType clazz;
            
            public SoidukiAndmedTypeSerializer(Paring3Soidukiandmed.ISoidukiAndmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("kateg");
                if (clazz.Kateg!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kateg))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Kateg");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("marknm");
                if (clazz.Marknm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Marknm))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : Marknm");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mudel_mod");
                if (clazz.MudelMod!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MudelMod))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kerenm");
                if (clazz.Kerenm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Kerenm))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootornm");
                if (clazz.Mootornm!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootornm))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootmht");
                if (clazz.Mootmht!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootmht))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("mootvms");
                if (clazz.Mootvms!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Mootvms))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("ehitaasta");
                if (clazz.Ehitaasta!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Ehitaasta))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("varv_nimetus");
                if (clazz.VarvNimetus!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VarvNimetus))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "kateg")) {
                    goto kateg;
                }
                else {
                    if ((Reader.LocalName == "marknm")) {
                        goto marknm;
                    }
                    else {
                        if ((Reader.LocalName == "mudel_mod")) {
                            goto mudel_mod;
                        }
                        else {
                            if ((Reader.LocalName == "kerenm")) {
                                goto kerenm;
                            }
                            else {
                                if ((Reader.LocalName == "mootornm")) {
                                    goto mootornm;
                                }
                                else {
                                    if ((Reader.LocalName == "mootmht")) {
                                        goto mootmht;
                                    }
                                    else {
                                        if ((Reader.LocalName == "mootvms")) {
                                            goto mootvms;
                                        }
                                        else {
                                            if ((Reader.LocalName == "ehitaasta")) {
                                                goto ehitaasta;
                                            }
                                            else {
                                                if ((Reader.LocalName == "varv_nimetus")) {
                                                    goto varv_nimetus;
                                                }
                                                else {
                                                    return;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            kateg:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>soiduki_andmed>kateg");
                }
                clazz.Kateg = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kateg")).Value;
                goto START;
            marknm:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>soiduki_andmed>marknm");
                }
                clazz.Marknm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("marknm")).Value;
                goto START;
            mudel_mod:
                if ((Reader.IsElementNil() == false)) {
                    clazz.MudelMod = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mudel_mod")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            kerenm:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Kerenm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kerenm")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootornm:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootornm = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootornm")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootmht:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootmht = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootmht")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            mootvms:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Mootvms = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("mootvms")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            ehitaasta:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Ehitaasta = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("ehitaasta")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            varv_nimetus:
                if ((Reader.IsElementNil() == false)) {
                    clazz.VarvNimetus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("varv_nimetus")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring3_soidukiandmed>oma_andmed_v", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring3Soidukiandmed.OmaAndmedVType))]
        public class OmaAndmedVTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring3Soidukiandmed.IOmaAndmedVType clazz;
            
            public OmaAndmedVTypeSerializer(Paring3Soidukiandmed.IOmaAndmedVType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("oma_kood");
                if (clazz.OmaKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_nimi");
                if (clazz.OmaNimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaNimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : OmaNimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_eesnimi");
                if (clazz.OmaEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaEesnimi))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("aadress");
                if (clazz.Aadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Aadress))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("asuk_akood");
                if (clazz.AsukAkood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.AsukAkood))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("oma_muud");
                if (clazz.OmaMuud!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.OmaMuud))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "oma_kood")) {
                    goto oma_kood;
                }
                else {
                    if ((Reader.LocalName == "oma_nimi")) {
                        goto oma_nimi;
                    }
                    else {
                        if ((Reader.LocalName == "oma_eesnimi")) {
                            goto oma_eesnimi;
                        }
                        else {
                            if ((Reader.LocalName == "aadress")) {
                                goto aadress;
                            }
                            else {
                                if ((Reader.LocalName == "asuk_akood")) {
                                    goto asuk_akood;
                                }
                                else {
                                    if ((Reader.LocalName == "oma_muud")) {
                                        goto oma_muud;
                                    }
                                    else {
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            oma_kood:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>oma_andmed_v>oma_kood");
                }
                clazz.OmaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_kood")).Value;
                goto START;
            oma_nimi:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>oma_andmed_v>oma_nimi");
                }
                clazz.OmaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_nimi")).Value;
                goto START;
            oma_eesnimi:
                if ((Reader.IsElementNil() == false)) {
                    clazz.OmaEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_eesnimi")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            aadress:
                if ((Reader.IsElementNil() == false)) {
                    clazz.Aadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("aadress")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            asuk_akood:
                if ((Reader.IsElementNil() == false)) {
                    clazz.AsukAkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("asuk_akood")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            oma_muud:
                if ((Reader.IsElementNil() == false)) {
                    clazz.OmaMuud = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("oma_muud")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring3_soidukiandmed>kaasoma_andmed_v", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring3Soidukiandmed.KaasomaAndmedVType))]
        public class KaasomaAndmedVTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring3Soidukiandmed.IKaasomaAndmedVType clazz;
            
            public KaasomaAndmedVTypeSerializer(Paring3Soidukiandmed.IKaasomaAndmedVType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("kaasoma_kood");
                if (clazz.KaasomaKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KaasomaKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KaasomaKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kaasoma_nimi");
                if (clazz.KaasomaNimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KaasomaNimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : KaasomaNimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kaasoma_eesnimi");
                if (clazz.KaasomaEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KaasomaEesnimi))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kaasoma_aadress");
                if (clazz.KaasomaAadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KaasomaAadress))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("kaasoma_asuk_akood");
                if (clazz.KaasomaAsukAkood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.KaasomaAsukAkood))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
            START:
                if ((Reader.LocalName == "kaasoma_kood")) {
                    goto kaasoma_kood;
                }
                else {
                    if ((Reader.LocalName == "kaasoma_nimi")) {
                        goto kaasoma_nimi;
                    }
                    else {
                        if ((Reader.LocalName == "kaasoma_eesnimi")) {
                            goto kaasoma_eesnimi;
                        }
                        else {
                            if ((Reader.LocalName == "kaasoma_aadress")) {
                                goto kaasoma_aadress;
                            }
                            else {
                                if ((Reader.LocalName == "kaasoma_asuk_akood")) {
                                    goto kaasoma_asuk_akood;
                                }
                                else {
                                    return;
                                }
                            }
                        }
                    }
                }
            kaasoma_kood:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>kaasoma_andmed_v>kaasoma_kood");
                }
                clazz.KaasomaKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasoma_kood")).Value;
                goto START;
            kaasoma_nimi:
                if (Reader.IsElementNil()) {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>kaasoma_andmed_v>kaasoma_nimi");
                }
                clazz.KaasomaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasoma_nimi")).Value;
                goto START;
            kaasoma_eesnimi:
                if ((Reader.IsElementNil() == false)) {
                    clazz.KaasomaEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasoma_eesnimi")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            kaasoma_aadress:
                if ((Reader.IsElementNil() == false)) {
                    clazz.KaasomaAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasoma_aadress")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            kaasoma_asuk_akood:
                if ((Reader.IsElementNil() == false)) {
                    clazz.KaasomaAsukAkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("kaasoma_asuk_akood")).Value;
                }
                else {
                    Reader.Skip();
                }
                goto START;
            }
        }
        
        [global::Xtee.Core.Attributes.XmlTypeAttribute(Name=">>paring3_soidukiandmed>vkasut_andmed", Namespace="http://producers.liiklusregister.xtee.riik.ee/producer/liiklusregister", Target=typeof(Paring3Soidukiandmed.VkasutAndmedType))]
        public class VkasutAndmedTypeSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
            
            protected Paring3Soidukiandmed.IVkasutAndmedType clazz;
            
            public VkasutAndmedTypeSerializer(Paring3Soidukiandmed.IVkasutAndmedType clazz) {
                this.clazz = clazz;
            }
            
            public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
                base.WriteXml(Writer);
                Writer.WriteStartElement("vkasut_kood");
                if (clazz.VkasutKood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VkasutKood))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VkasutKood");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("vkasut_nimi");
                if (clazz.VkasutNimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VkasutNimi))).ToString());
                }
                else {
                    throw new global::Xtee.Core.Exceptions.NillableNotAllowedException("Nullable is not allowed for element : VkasutNimi");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("vkasut_eesnimi");
                if (clazz.VkasutEesnimi!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VkasutEesnimi))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("vkasut_aadress");
                if (clazz.VkasutAadress!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VkasutAadress))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
                Writer.WriteStartElement("vkasut_asuk_akood");
                if (clazz.VkasutAsukAkood!=null) {
                    Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                    Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.VkasutAsukAkood))).ToString());
                }
                else {
                    Writer.WriteAttributeString("xsi", "nil", null, "1");
                }
                Writer.WriteEndElement();
            }
            
            public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
                base.ReadXml(Reader);
                if (Reader.LocalName=="vkasut_kood") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_kood");
                    }
                    clazz.VkasutKood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vkasut_kood")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_kood", Reader.LocalName);
                }
                if (Reader.LocalName=="vkasut_nimi") {
                    if (Reader.IsElementNil()) {
                        throw new global::Xtee.Core.Exceptions.NillableNotAllowedException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_nimi");
                    }
                    clazz.VkasutNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vkasut_nimi")).Value;
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_nimi", Reader.LocalName);
                }
                if (Reader.LocalName=="vkasut_eesnimi") {
                    if ((Reader.IsElementNil() == false)) {
                        clazz.VkasutEesnimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vkasut_eesnimi")).Value;
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_eesnimi", Reader.LocalName);
                }
                if (Reader.LocalName=="vkasut_aadress") {
                    if ((Reader.IsElementNil() == false)) {
                        clazz.VkasutAadress = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vkasut_aadress")).Value;
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_aadress", Reader.LocalName);
                }
                if (Reader.LocalName=="vkasut_asuk_akood") {
                    if ((Reader.IsElementNil() == false)) {
                        clazz.VkasutAsukAkood = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("vkasut_asuk_akood")).Value;
                    }
                    else {
                        Reader.Skip();
                    }
                }
                else {
                    throw new global::Xtee.Core.Exceptions.UnExpectedElementException(">>>paring3_soidukiandmed>vkasut_andmed>vkasut_asuk_akood", Reader.LocalName);
                }
            }
        }
    }
}
